<template>
  <div>
    <!-- 商品列表 -->
    <van-tabs type="card"  color="coral">
      <van-tab v-for="(item,index) in list" :key="item" :title="list[index]">
        <goods-list v-if="goods[index]" :arr="goods[index].content"></goods-list>
      </van-tab>
    </van-tabs>
  </div>
</template>

<script>
import goodsList from "../../../components/goodslist.vue"
import axios from "axios";
export default {
  components:{
    goodsList
  },
  data(){
    return {
      list:["热门推荐","上新推荐","所有商品"],
      goods:[]
    }
  },
  mounted(){
    axios({
      url:"/api/gethortgoods",
      method:"get"
    }).then(res=>{
      console.log(res);
      this.goods = res.data.list;

    })
  }
};
</script>

<style scoped>
</style>